home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Apple WWDC 1996
/
WWDC96_1996 (CD).toast
/
Technology Materials
/
MacOS 8 Resources
/
Developer Tools
/
Mac OS 8 Interfaces & Libraries
/
Interfaces
/
CIncludes
/
TextServices.h
< prev
next >
Wrap
C/C++ Source or Header
|
1996-05-01
|
16KB
|
457 lines
/*
File: TextServices.h
Contains: Text Services Manager Interfaces.
Version: Technology: System 7.5
Release: Universal Interfaces 3.0d3 on Copland DR1
Copyright: © 1984-1996 by Apple Computer, Inc. All rights reserved.
Bugs?: If you find a problem with this file, send the file and version
information (from above) and the problem description to:
Internet: apple.bugs@applelink.apple.com
AppleLink: APPLE.BUGS
*/
#ifndef __TEXTSERVICES__
#define __TEXTSERVICES__
#ifndef __CONDITIONALMACROS__
#include <ConditionalMacros.h>
#endif
#ifndef __TYPES__
#include <Types.h>
#endif
#ifndef __EVENTS__
#include <Events.h>
#endif
#ifndef __MENUS__
#include <Menus.h>
#endif
#ifndef __AEDATAMODEL__
#include <AEDataModel.h>
#endif
#ifndef __AEREGISTRY__
#include <AERegistry.h>
#endif
#ifndef __COMPONENTS__
#include <Components.h>
#endif
#if FOR_SYSTEM8_PREEMPTIVE
#ifndef __TEXTOBJECTS__
#include <TextObjects.h>
#endif
#ifndef __LOCALEOBJECTS__
#include <LocaleObjects.h>
#endif
#ifndef __COLLECTIONS__
#include <Collections.h>
#endif
#ifndef __HILISTTYPES__
#include <HIListTypes.h>
#endif
#ifndef __HIWINDOWTYPES__
#include <HIWindowTypes.h>
#endif
#endif
#ifdef __cplusplus
extern "C" {
#endif
#if PRAGMA_IMPORT_SUPPORTED
#pragma import on
#endif
#if PRAGMA_ALIGN_SUPPORTED
#pragma options align=mac68k
#endif
#if FOR_SYSTEM7_AND_SYSTEM8_PREEMPTIVE
enum {
kTextService = 'tsvc', /* component type for the component description */
kInputMethodService = 'inpm', /* component subtype for the component description */
kTSMVersion = 0x0200, /* Version of the Text Services Manager is 2.0 */
kTextServiceVersion2 = 'tsv2' /* Interface type for V2 interfaces */
};
/* Standard collection tags*/
enum {
kInteractiveServicesTag = 'tmin',
kLocaleIDTag = 'loce',
kTextInputObjectTag = 'tiot',
kLocaleObjectRefTag = 'lobj',
kLocaleRefTag = 'lref',
kKeyboardInputMethodContextTag = 'kinp',
kKeyboardLocaleObjectRefTag = 'kilo',
kHandwritingInputMethodContextTag = 'hinp',
kHandwritingLocaleObjectRefTag = 'hilo',
kSpeechInputMethodContextTag = 'sinp',
kSpeechLocaleObjectRefTag = 'silo',
kPasswordModeTag = 'pwdm',
kRefconTag = 'refc',
kUseFloatingWindowTag = 'uswm',
kReadOnlyDocumentTag = 'isro',
kSupportsMultiInlineHolesTag = 'minl',
kProtocolVersionTag = 'nprt',
kTSMContextCollectionTag = 'tsmx'
};
/* Standard tags for input method modes*/
enum {
kIMRomanInputMode = 'romn',
kIMPasswordInputMode = 'pasw',
kIMXingInputMode = 'xing',
kIMHuaInputMode = 'huam',
kIMPinyinInputMode = 'piny',
kIMQuweiInputMode = 'quwe',
kIMCangjieInputMode = 'cgji',
kIMJianyiInputMode = 'jnyi',
kIMZhuyinInputMode = 'zhuy',
kIMB5CodeInputMode = 'b5cd',
kIMKatakanaInputMode = 'kata',
kIMHiraganaInputMode = 'hira'
};
/* Variant tags for the input modes*/
enum {
kIM2ByteInputMode = '2byt',
kIM1ByteInputMode = '1byt',
kIMDirectInputMode = 'dinp'
};
/* Text Services LocaleObject Attributes*/
#define kKeyboardInputMethodTypeName "\pkeyboardinputmethod"
#define kHandwritingInputMethodTypeName "\phandwritinginputmethod"
#define kSpeechInputMethodTypeName "\pspeechinputmethod"
#define kTokenizeServiceTypeName "\ptokenizetextservice"
#define kInteractiveTextServiceTypeName "\pinteractivetextservice"
#define kInputMethodModeName "\pinputmethodmode"
#define kInputMethodModeVariantName "\pinputmethodvariantmode"
enum {
kNeedsInputWindow = 1,
kHandlesUpdateRegion = 2,
kHandlesGetRegion = 3,
kHandlesPos2Offset = 4,
kHandlesOffset2Pos = 5,
kInPasswordMode = 6,
kHandleMultipleHoles = 7,
kDocumentIsReadOnly = 8
};
#endif
#if FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED
enum {
/* Component Flags in ComponentDescription */
bTakeActiveEvent = 15, /* bit set if the component takes active event */
bHandleAERecording = 16, /* bit set if the component takes care of recording Apple Events <new in vers2.0> */
bScriptMask = 0x00007F00, /* bit 8 - 14 */
bLanguageMask = 0x000000FF, /* bit 0 - 7 */
bScriptLanguageMask = bScriptMask + bLanguageMask /* bit 0 - 14 */
};
enum {
/* Low level routines which are dispatched directly to the Component Manager */
kCMGetScriptLangSupport = 0x0001, /* Component Manager call selector 1 */
kCMInitiateTextService = 0x0002, /* Component Manager call selector 2 */
kCMTerminateTextService = 0x0003, /* Component Manager call selector 3 */
kCMActivateTextService = 0x0004, /* Component Manager call selector 4 */
kCMDeactivateTextService = 0x0005, /* Component Manager call selector 5 */
kCMTextServiceEvent = 0x0006, /* Component Manager call selector 6 */
kCMGetTextServiceMenu = 0x0007, /* Component Manager call selector 7 */
kCMTextServiceMenuSelect = 0x0008, /* Component Manager call selector 8 */
kCMFixTextService = 0x0009, /* Component Manager call selector 9 */
kCMSetTextServiceCursor = 0x000A, /* Component Manager call selector 10 */
kCMHidePaletteWindows = 0x000B /* Component Manager call selector 11 */
};
/* extract Script/Language code from Component flag ... */
#define mGetScriptCode(cdRec) ((ScriptCode) ((cdRec.componentFlags & bScriptMask) >> 8))
#define mGetLanguageCode(cdRec) ((LangCode) cdRec.componentFlags & bLanguageMask)
#endif
#if FOR_SYSTEM8_PREEMPTIVE
struct TSMServiceSpecification {
StringPtr objectName;
ItemCount countPairs;
NameValuePair * pairs;
};
typedef struct TSMServiceSpecification TSMServiceSpecification;
typedef TSMServiceSpecification *TSMServiceSpecificationPtr;
/* New opaque definitions for types*/
typedef struct OpaqueTSMContext* TSMContext;
typedef struct OpaqueTSMServiceContextRef* TSMServiceContextRef;
#endif
#if FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE
/* New opaque definitions for types*/
typedef struct OpaqueTSMDocumentID* TSMDocumentID;
typedef OSType InterfaceTypeList[1];
#endif
#if FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED
/* Text Service Info List */
struct TextServiceInfo {
Component fComponent;
Str255 fItemName;
};
typedef struct TextServiceInfo TextServiceInfo;
typedef TextServiceInfo *TextServiceInfoPtr;
struct TextServiceList {
short fTextServiceCount; /* number of entries in the 'fServices' array */
TextServiceInfo fServices[1]; /* Note: array of 'TextServiceInfo' records follows */
};
typedef struct TextServiceList TextServiceList;
typedef TextServiceList *TextServiceListPtr;
typedef TextServiceListPtr *TextServiceListHandle;
struct ScriptLanguageRecord {
ScriptCode fScript;
LangCode fLanguage;
};
typedef struct ScriptLanguageRecord ScriptLanguageRecord;
struct ScriptLanguageSupport {
short fScriptLanguageCount; /* number of entries in the 'fScriptLanguageArray' array */
ScriptLanguageRecord fScriptLanguageArray[1]; /* Note: array of 'ScriptLanguageRecord' records follows */
};
typedef struct ScriptLanguageSupport ScriptLanguageSupport;
typedef ScriptLanguageSupport *ScriptLanguageSupportPtr;
typedef ScriptLanguageSupportPtr *ScriptLanguageSupportHandle;
#endif
#if FOR_SYSTEM8_PREEMPTIVE
/* Low level TSMContext routines */
extern OSStatus NewTSMContext(TSMContext *context, LocaleRef locale, long refcon);
extern OSStatus DeleteTSMContext(TSMContext context);
extern OSStatus OpenTSMService(TSMContext context, LocaleObjectRef service);
extern OSStatus CloseTSMService(TSMContext context);
extern OSStatus GetTSMService(TSMContext context, TSMServiceSpecification *serviceSpec, LocaleObjectRef *service);
extern OSStatus NextTSMService(TSMContext context, LocaleObjectRef *service);
extern OSStatus GetTSMRefcon(TSMContext context, long *refcon);
extern OSStatus SetTSMRefcon(TSMContext context, long refcon);
extern OSStatus GetTSMLocale(TSMContext context, LocaleRef *locale);
extern OSStatus SetTSMLocale(TSMContext context, LocaleRef locale);
extern void *GetSOMObjectFromTSMContext(TSMContext context);
extern OSStatus AddTSMContextCollectionItem(TSMContext context, CollectionTag itemTag, UInt32 id, ByteCount itemSize, void *itemData);
extern OSStatus GetTSMContextCollectionItemData(TSMContext context, CollectionTag tag, UInt32 id, ByteCount sizeAllowed, ByteCount *sizeReturned, void *itemData);
extern OSStatus RemoveTSMContextCollectionItem(TSMContext context, CollectionTag itemTag, UInt32 id);
#endif
#if FOR_SYSTEM8_COOPERATIVE
/* Text Service Info List */
struct InlineEditInfo {
UInt32 fStart;
UInt32 fEnd;
TextObject fText;
};
typedef struct InlineEditInfo InlineEditInfo;
typedef InlineEditInfo *InlineEditInfoPtr;
/* New handler routines */
extern OSStatus SetTSMEnabled(Boolean state);
extern OSStatus SetTSMDocumentPasswordMode(TSMDocumentID idocID, Boolean Enabled);
extern OSStatus AddTSMDocumentCollectionItem(TSMDocumentID idocID, CollectionTag itemTag, UInt32 id, ByteCount itemSize, void *itemData);
extern OSStatus GetTSMDocumentCollectionItemData(TSMDocumentID idocID, CollectionTag tag, UInt32 id, ByteCount sizeAllowed, ByteCount *sizeReturned, void *itemData);
extern OSStatus RemoveTSMDocumentCollectionItem(TSMDocumentID idocID, CollectionTag itemTag, UInt32 id);
extern OSStatus ReleaseTSMDocumentInlineHoles(TSMDocumentID idocID);
/* Low level TSMContext routines */
extern OSStatus FixTSMContext(TSMContext context);
extern OSStatus ActivateTSMContext(TSMContext context);
extern OSStatus DeactivateTSMContext(TSMContext context);
#if FOR_PTR_BASED_AE
extern OSStatus EditInlineRegion(TSMContext context, AppleEvent *theEvent);
#endif
extern OSStatus ReleaseTSMContextInlineHoles(TSMContext context);
extern OSStatus TSMContextUseFloatingWindow(TSMContext context, Boolean useWindow);
extern OSStatus TSMContextSetPasswordMode(TSMContext context, Boolean Enabled);
extern Boolean GetTSMFeature(TSMContext context, UInt32 feature);
extern HILayerRef GetTSMHILayer(void );
/* Text service developer API's */
extern OSStatus TSMRegisterMenu(TSMContext context, HIMenu *menu);
#if FOR_PTR_BASED_AE
extern OSStatus GetTSMUpdateEvent(AppleEvent **theAppleEvent, TSMContext context, TextObject theText, long fixLen, ReplaceRangeArrayPtr updateRng, HiliteRangeArrayPtr hiliteRng, ClauseOffsetArrayPtr clauseRgn, TextRegionRangePtr pinRange, UInt32 InlineHoleID);
extern OSStatus GetTSMPosToOffsetEvent(AppleEvent **theAppleEvent, TSMContext context, Point point, Boolean Dragging);
extern OSStatus GetTSMOffsetToPosEvent(AppleEvent **theAppleEvent, TSMContext context, ByteOffset offset, UInt32 InlineHoleID);
extern OSStatus GetTSMGetRegionEvent(AppleEvent **theAppleEvent, TSMContext context, GetRegionClass requestType, GetRegionRangePtr requestRange, UInt32 InlineHoleID);
extern OSStatus GetTSMShowHideWindowEvent(AppleEvent **theAppleEvent, TSMContext context, Boolean showIt, Boolean InquireState);
extern OSStatus GetTSMServiceChangedEvent(AppleEvent **theAppleEvent, TSMContext context);
extern OSStatus GetTSMReplyEvent(AppleEvent **theAppleEvent, TSMContext context);
extern OSStatus AESendFromTSMService(TSMContext context, const AppleEvent *theAppleEvent, AppleEvent *reply);
#endif
extern OSStatus PostTSMText(TSMContext context, TextObject text);
extern OSStatus GetTSMFloatingWindowGlobalRect(TSMContext context, Rect *globalRect);
#endif
#if FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE
/* High level TSM Doucment routines */
extern pascal OSErr NewTSMDocument(short numOfInterface, InterfaceTypeList supportedInterfaceTypes, TSMDocumentID *idocID, long refcon)
TWOWORDINLINE(0x7000, 0xAA54);
extern pascal OSErr DeleteTSMDocument(TSMDocumentID idocID)
TWOWORDINLINE(0x7001, 0xAA54);
extern pascal OSErr ActivateTSMDocument(TSMDocumentID idocID)
TWOWORDINLINE(0x7002, 0xAA54);
extern pascal OSErr DeactivateTSMDocument(TSMDocumentID idocID)
TWOWORDINLINE(0x7003, 0xAA54);
extern pascal Boolean SetTSMCursor(Point mousePos)
TWOWORDINLINE(0x7006, 0xAA54);
extern pascal OSErr FixTSMDocument(TSMDocumentID idocID)
TWOWORDINLINE(0x7007, 0xAA54);
/* Utilities */
extern pascal OSErr UseInputWindow(TSMDocumentID idocID, Boolean useWindow)
TWOWORDINLINE(0x7010, 0xAA54);
#endif
#if FOR_SYSTEM7_ONLY
/* Redundant Utilities */
extern pascal OSErr SendAEFromTSMComponent(const AppleEvent *theAppleEvent, AppleEvent *reply, AESendMode sendMode, AESendPriority sendPriority, long timeOutInTicks, AEIdleUPP idleProc, AEFilterUPP filterProc)
TWOWORDINLINE(0x700B, 0xAA54);
extern pascal OSErr NewServiceWindow(void *wStorage, const Rect *boundsRect, ConstStr255Param title, Boolean visible, short theProc, WindowPtr behind, Boolean goAwayFlag, ComponentInstance ts, WindowPtr *window)
TWOWORDINLINE(0x7011, 0xAA54);
extern pascal OSErr CloseServiceWindow(WindowPtr window)
TWOWORDINLINE(0x7012, 0xAA54);
extern pascal OSErr GetFrontServiceWindow(WindowPtr *window)
TWOWORDINLINE(0x7013, 0xAA54);
extern pascal short FindServiceWindow(Point thePoint, WindowPtr *theWindow)
TWOWORDINLINE(0x7017, 0xAA54);
extern pascal OSErr SetDefaultInputMethod(Component ts, ScriptLanguageRecord *slRecordPtr)
TWOWORDINLINE(0x700C, 0xAA54);
extern pascal OSErr GetDefaultInputMethod(Component *ts, ScriptLanguageRecord *slRecordPtr)
TWOWORDINLINE(0x700D, 0xAA54);
extern pascal OSErr SetTextServiceLanguage(ScriptLanguageRecord *slRecordPtr)
TWOWORDINLINE(0x700E, 0xAA54);
extern pascal OSErr GetTextServiceLanguage(ScriptLanguageRecord *slRecordPtr)
TWOWORDINLINE(0x700F, 0xAA54);
extern pascal Boolean TSMEvent(EventRecord *event)
TWOWORDINLINE(0x7004, 0xAA54);
extern pascal Boolean TSMMenuSelect(long menuResult)
TWOWORDINLINE(0x7005, 0xAA54);
extern pascal OSErr InitTSMAwareApplication(void )
TWOWORDINLINE(0x7014, 0xAA54);
extern pascal OSErr CloseTSMAwareApplication(void )
TWOWORDINLINE(0x7015, 0xAA54);
/* Component Manager Interfaces to Input Methods */
extern pascal ComponentResult GetScriptLanguageSupport(ComponentInstance ts, ScriptLanguageSupportHandle *scriptHdl)
FIVEWORDINLINE(0x2F3C, 0x0004, 0x0001, 0x7000, 0xA82A);
extern pascal ComponentResult InitiateTextService(ComponentInstance ts)
FIVEWORDINLINE(0x2F3C, 0x0000, 0x0002, 0x7000, 0xA82A);
extern pascal ComponentResult TerminateTextService(ComponentInstance ts)
FIVEWORDINLINE(0x2F3C, 0x0000, 0x0003, 0x7000, 0xA82A);
extern pascal ComponentResult ActivateTextService(ComponentInstance ts)
FIVEWORDINLINE(0x2F3C, 0x0000, 0x0004, 0x7000, 0xA82A);
extern pascal ComponentResult DeactivateTextService(ComponentInstance ts)
FIVEWORDINLINE(0x2F3C, 0x0000, 0x0005, 0x7000, 0xA82A);
extern pascal ComponentResult TextServiceEvent(ComponentInstance ts, short numOfEvents, EventRecord *event)
FIVEWORDINLINE(0x2F3C, 0x0006, 0x0006, 0x7000, 0xA82A);
extern pascal ComponentResult GetTextServiceMenu(ComponentInstance ts, MenuHandle *serviceMenu)
FIVEWORDINLINE(0x2F3C, 0x0004, 0x0007, 0x7000, 0xA82A);
extern pascal ComponentResult TextServiceMenuSelect(ComponentInstance ts, MenuHandle serviceMenu, short item)
FIVEWORDINLINE(0x2F3C, 0x0006, 0x0008, 0x7000, 0xA82A);
extern pascal ComponentResult FixTextService(ComponentInstance ts)
FIVEWORDINLINE(0x2F3C, 0x0000, 0x0009, 0x7000, 0xA82A);
extern pascal ComponentResult SetTextServiceCursor(ComponentInstance ts, Point mousePos)
FIVEWORDINLINE(0x2F3C, 0x0004, 0x000A, 0x7000, 0xA82A);
extern pascal ComponentResult HidePaletteWindows(ComponentInstance ts)
FIVEWORDINLINE(0x2F3C, 0x0000, 0x000B, 0x7000, 0xA82A);
extern pascal OSErr GetServiceList(short numOfInterface, OSType *supportedInterfaceTypes, TextServiceListHandle *serviceInfo, long *seedValue)
TWOWORDINLINE(0x7008, 0xAA54);
extern pascal OSErr OpenTextService(TSMDocumentID idocID, Component aComponent, ComponentInstance *aComponentInstance)
TWOWORDINLINE(0x7009, 0xAA54);
extern pascal OSErr CloseTextService(TSMDocumentID idocID, ComponentInstance aComponentInstance)
TWOWORDINLINE(0x700A, 0xAA54);
#endif
#if PRAGMA_ALIGN_SUPPORTED
#pragma options align=reset
#endif
#if PRAGMA_IMPORT_SUPPORTED
#pragma import off
#endif
#ifdef __cplusplus
}
#endif
#endif /* __TEXTSERVICES__ */